package com.ttbj.rule.service.impl;

import com.ttbj.product.bean.dto.CargoDto;
import com.ttbj.rule.po.CarriageRule;
import com.ttbj.rule.service.BillStrategy;

/**
 * 数量计费
 * @author Medivh
 * @date 2018年6月7日 上午10:20:06
 */
public class BillNumStrategy implements BillStrategy {
	
	@Override
	public Float strategyInterface(Float distance,CargoDto cargo,CarriageRule bill) {
		/*货物数量*/
		Integer cargoAmount = cargo.getCargoAmount();
		cargoAmount = cargoAmount == null || cargoAmount <= 0  ? 1 : cargoAmount;
		/*单价*/
		Float unit = bill.getBillUnitPrice();
		return    unit == null? 0f:cargoAmount*unit;
	}
 
}
